<?php include('php/authenticatephastregex.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
  <head>
    <title>Phastregex. in-silico chip-seq</title>
    <meta http-equiv="Content-Type" content ="text/html; charset=utf-8">
    <link rel="stylesheet" href="phastregexstylejw.css" type="text/css">
    <?php include('php/jasonweirather.php'); ?>
  </head>
  <body>
    <?php include('php/logoline.php'); ?>
    
    <?php
      if($_POST["pid"] != NULL) {
        $kcom = 'kill ' . $_POST["pid"];
        `$kcom`;
        echo "$kcom executed<br>\n";
      }
      sleep(1);
      $command = "ps -ef";
      $lines  = '';
      $lines = `top -b -n 1 | grep www-data`;
      $arr = explode("\n",$lines);
      echo('<div id = "joblist">');
      echo('<form enctype="multipart/form-data" action="'.$self.'" method="post">');
      foreach ($arr as &$line) {
        $line = trim($line);
        $fields = preg_split('/\s+/',$line);
        $pid = $fields[0];
        if($pid != NULL) {
          $line = htmlentities($line);
          echo '<input type=radio name ="pid" value = "'.$pid.'">' . "$line</input><br>\n";
        }
      }
      echo('</div>');
      echo('<input type="submit" value="Kill process (use sparingly)."/>');
      echo('</form>');
      #echo $lines . "\n";
    ?>
    <?php include('php/lastline.php'); ?>
  </body>
</html> 
